cmake_minimum_required(VERSION 3.8)
project(test_nav2_dwb)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(glog REQUIRED)
find_package(common_lib REQUIRED)
find_package(nav2_common REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(rclcpp REQUIRED)
find_package(costmap_queue REQUIRED)
find_package(pluginlib REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_2d_msgs REQUIRED)


if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

# export ROS2_WS_ROOT="/home/xxty/trobot/ros2_ws"
set(WORKSPACE_ROOT "$ENV{ROS2_WS_ROOT}")
set(COMMON_DIR "${WORKSPACE_ROOT}/src/common")
MESSAGE(STATUS "COMMON_DIR = ${COMMON_DIR}")

include_directories(
  include
  ${COMMON_DIR}
)

set(dependencies
  rclcpp
  common_lib
  nav2_costmap_2d
  costmap_queue
  nav_msgs
  geometry_msgs
  nav_2d_msgs
)

add_executable(test_costmap_queue 
  src/costmap_queue/costmap_queue.cpp
  src/costmap_queue/limited_costmap_queue.cpp
  src/test_costmap_queue.cpp
)
ament_target_dependencies(test_costmap_queue 
  ${dependencies} 
)
target_link_libraries(test_costmap_queue 
  glog::glog
  # -ldw
)

add_executable(test_trajectory 
  src/test_trajectory.cpp
)
ament_target_dependencies(test_trajectory 
  ${dependencies} 
)
target_link_libraries(test_trajectory 
  glog::glog
  # -ldw
)


install(TARGETS
  test_costmap_queue
  test_trajectory
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()
